<?php
namespace Anls\Common;
use Think\Controller;


/**
 * 模块公共抽象类
 * @author wsf
 *
 */
abstract class AbstractCommonBaseController extends Controller {
	
    protected $redis = null;
    
    protected $redis_k_db = null;
    
    protected $redis_k_db_log = null;
    
    
    
    public function _initialize(){
        if($this->redis == null) $this->initRedis();
        if($this->redis_k_db == null) $this->initRedisKDB();
    }
    
    protected function initRedis(){
        if($this->redis == null){
            $this->redis = new \Redis();
            $this->redis->connect('127.0.0.1',6379);
        }
        return $this->redis;
    }
    
    protected function initRedisKDB(){
        if($this->redis_k_db == null){
            $this->redis_k_db = new \Redis();
            $this->redis_k_db->connect('127.0.0.1',6379);
            $this->redis_k_db->select(1);
            
            $this->redis_k_db_log = new \Redis();
            $this->redis_k_db_log->connect('127.0.0.1',6379);
            $this->redis_k_db_log->select(2);
        }
        return $this->redis_k_db;
    }
    
}